package cn.hahah.module.blog.dal.mysql.userhistorybrowse;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.userhistorybrowse.UserHistoryBrowseDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.userhistorybrowse.vo.*;

/**
 * 用户文章浏览记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserHistoryBrowseMapper extends BaseMapperX<UserHistoryBrowseDO> {

    default PageResult<UserHistoryBrowseDO> selectPage(UserHistoryBrowsePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserHistoryBrowseDO>()
                .eqIfPresent(UserHistoryBrowseDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserHistoryBrowseDO::getArticleId, reqVO.getArticleId())
                .betweenIfPresent(UserHistoryBrowseDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserHistoryBrowseDO::getId));
    }

}